php session failure

php session failure

am 21.08.2007 21:48:10 von Garry Jones

In a php session I have set up a user can input several hundred values
on a form.

I then show the user what he or she has entered on a preview page
which he or she can then click ok or cancel.

On clicking cancel the user should be backed using this code




 




I have used this before at it worked. However it now returns the user
to the previous page (form entry), but now all the values are empty.
Annoying if the user just made one simple mistake in the several
hundred entries they wanted to correct.

Any ideas what I am doing wrong?

Any other tricks to acheive this?

Garry Jones
Sweden

Re: php session failure

am 21.08.2007 22:11:31 von ELINTPimp

On Aug 21, 3:48 pm, GarryJones wrote:
> In a php session I have set up a user can input several hundred values
> on a form.
>
> I then show the user what he or she has entered on a preview page
> which he or she can then click ok or cancel.
>
> On clicking cancel the user should be backed using this code
>
>
>


>
>  
>
>

>
>
> I have used this before at it worked. However it now returns the user
> to the previous page (form entry), but now all the values are empty.
> Annoying if the user just made one simple mistake in the several
> hundred entries they wanted to correct.
>
> Any ideas what I am doing wrong?
>
> Any other tricks to acheive this?
>
> Garry Jones
> Sweden

Do you have session_start() on top of both pages?
Post a snippit of offending HTML code of the form entry page, for now,
please.

Re: php session failure

am 21.08.2007 23:32:53 von Garry Jones

> Do you have session_start() on top of both pages?

Yes I do.

The file for data entry - looks like this...





VT Admin



Anmälan av deltgare Kansli


Använd deltagares för manual inmätningar under
säsongen. Det här är för det stora inmätning efter loppet

Fyll i uppgifterna och klicka på
Fortsätt


id=3D"kansli">




$vtcnt =3D "30";
$dna =3D 1;
while ($dna < $vtcnt) {
include("vtdelt_rowa_admin.php");
$dna++;
include("vtdelt_rowb_admin.php");
$dna++;
}
?>
etc


************
End quote
..... the files vtdelt_rowa_admin.php and vtdelt_rowb_admin.php
include the code for the form entry and are called in alternately
until I have 30 subsets of code with up to ten rows in each, thats 300
data entry fields.


Any idea?

Garry Jones
Sweden

Re: php session failure

am 22.08.2007 00:51:20 von Jerry Stuckle

GarryJones wrote:
> In a php session I have set up a user can input several hundred values
> on a form.
>
> I then show the user what he or she has entered on a preview page
> which he or she can then click ok or cancel.
>
> On clicking cancel the user should be backed using this code
>
>


>
> I have used this before at it worked. However it now returns the user
> to the previous page (form entry), but now all the values are empty.
> Annoying if the user just made one simple mistake in the several
> hundred entries they wanted to correct.
>
> Any ideas what I am doing wrong?
>
> Any other tricks to acheive this?
>
> Garry Jones
> Sweden
>

As you've found, history.back() is not foolproof. And what if they have
javascript disabled?

It's harder, but put the cancel button in a form. In that form have the
values as hidden fields, i.e.






Then on entrypage.php use:

$value1 = isset($_POST['value1']) ? $_POST['value1'] : "";
$value2 = isset($_POST['value2']) ? $_POST['value2'] : "";
$value3 = isset($_POST['value3']) ? $_POST['value3'] : "";
%>
....





Of course, loops and arrays can make the coding simpler.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: php session failure

am 22.08.2007 06:47:55 von Garry Jones

> As you've found, history.back() is not foolproof. And what if they have javascript disabled?
> It's harder, but put the cancel button in a form. In that form have the values as hidden fields, i.e.

The strange thing is I have identical code that works for users
elsewhere on the site. In "user entry" the number of entries allowed
is 10 sets of 10. This is where users enter themselves and club
members into events.

This particular code is for the race organisers to enter the details
of particpiants who register "on the line" by filling in a form. The
race office then needs to be able to enter all this data. Some race
organisers need to key in several thousand entrants. I chose 30 at a
time as a balance between "ease of use" and "risk of lost data during
entry". (Not nice to have keyed in 3000 lines of code and see the
computer screen go blank when the tea lady trips over the cable just
as you where about to press enter).

Anyway, I have much more control about java being on and so on as it
is a limited number of people actually keying in this data. This entry
form is also hidden behind an admin login folder on the website and
this not open to the masses.

So its strange that history.back() works on the initial code but not
on this. My coding is identical except for the inclusion of more rows
and the fact that its behind a htaccess/htpasswd page.

However I have already stored the values as hidden on the preview page
so I simply need to use the "value=" on the form entry page to fix it.
So problem solved, but its still strange how identical code works/
doesn't work on the same website from my own pc.

Thanks for your help
Garry Jones
Sweden

Re: php session failure

am 22.08.2007 06:55:24 von Garry Jones

I solved it.

I simply removed the session_start() from the top of the user entry
form.

I dont use any session variables until the preview page when the
values are read in. Neither was I using the session_start() on the
other entry form I referred to above.

Ah, mayybe thats what ELINTPimp meant....? ie "do you have....?"
because its wrong to do so....???

Garry Jones
Sweden

Re: php session failure

am 22.08.2007 13:38:51 von Jerry Stuckle

GarryJones wrote:
>> As you've found, history.back() is not foolproof. And what if they have javascript disabled?
>> It's harder, but put the cancel button in a form. In that form have the values as hidden fields, i.e.
>
> The strange thing is I have identical code that works for users
> elsewhere on the site. In "user entry" the number of entries allowed
> is 10 sets of 10. This is where users enter themselves and club
> members into events.
>

It can be a lot of things. For one thing, you're depending on the
browser cache to fill in the fields.

> This particular code is for the race organisers to enter the details
> of particpiants who register "on the line" by filling in a form. The
> race office then needs to be able to enter all this data. Some race
> organisers need to key in several thousand entrants. I chose 30 at a
> time as a balance between "ease of use" and "risk of lost data during
> entry". (Not nice to have keyed in 3000 lines of code and see the
> computer screen go blank when the tea lady trips over the cable just
> as you where about to press enter).
>

A reasonable compromise.

> Anyway, I have much more control about java being on and so on as it
> is a limited number of people actually keying in this data. This entry
> form is also hidden behind an admin login folder on the website and
> this not open to the masses.
>

You're not using java. You're using javascript. The only thing they
have in common are two 'a's, a 'j' and a 'v'.

> So its strange that history.back() works on the initial code but not
> on this. My coding is identical except for the inclusion of more rows
> and the fact that its behind a htaccess/htpasswd page.
>

And can also be dependent on the amount of data being entered.

> However I have already stored the values as hidden on the preview page
> so I simply need to use the "value=" on the form entry page to fix it.
> So problem solved, but its still strange how identical code works/
> doesn't work on the same website from my own pc.
>

That's the only sure-fire way. Your way depends on certain behavior by
the browser (javascript enabled, cache enabled and large enough) which
can be changed by the user.


> Thanks for your help
> Garry Jones
> Sweden
>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: php session failure

am 22.08.2007 13:40:32 von Jerry Stuckle

GarryJones wrote:
> I solved it.
>
> I simply removed the session_start() from the top of the user entry
> form.
>
> I dont use any session variables until the preview page when the
> values are read in. Neither was I using the session_start() on the
> other entry form I referred to above.
>
> Ah, mayybe thats what ELINTPimp meant....? ie "do you have....?"
> because its wrong to do so....???
>
> Garry Jones
> Sweden
>

No, your first message was "session failure" - which is why he asked the
question. But your question has to do with javascript and history - and
has nothing to do with session failure.

See my other note - you're depending a lot on the browser which may or
may be configured to do what you want.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Var noga med att
ange färdvägen för varje deltagare

FV1 =3D 140km, FV2 =3D 88km, FV3 =3D 35km,
Tom=3DIngen färdväg vald

>

>
>  
>
>

>